<?php
/**
 * 首页
 * Created by PhpStorm.
 * User: jason
 * Date: 18-8-22
 * Time: 上午9:36
 */
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Redis;
class IndexController extends  Controller
{
    public function Index(){
        return view('index.index');
    }

    public function RedisTest(){
        /*//设置redis
        Redis::set('name','luojunwei',10);
        //设置redis　key过期时间(秒)
        Redis::EXPIRE('name',10);
        //删除redis key
        Redis::del('name');
        //获取redis key
        Redis::get('name');
        //redis hash设置数据
        Redis::hset('jasonObject','name','luojunwei');
        Redis::hset('jasonObject','age','28');
        //hash获取单个数据
        Redis::hget('jasonObject','name');
        //hash获取全部数据
        Redis::hgetall('jasonObject');*/
        /*Redis::rpush('message','消息一');
        Redis::rpush('message','消息二');
        Redis::rpush('message','消息三');*/
        //$messages = Redis::lrange('message',0,-1);
        $push = Redis::lpop('message');
        print_r($push);
        $messages = Redis::lrange('message',0,-1);
        print_r($messages);
    }
}